﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Deedle;
namespace ConsoleApp1 {
    class Program {
        static void Main(string[] args) {
            // Generate collection of rows 13123213213321331232132112323
            var rows = Enumerable.Range(0, 100).Select(i => {
                // Build each row using series builder & return 
                // KeyValue representing row key with row data
                var sb = new SeriesBuilder<string>();
                sb.Add("Index", i);
                sb.Add("Sin", Math.Sin(i / 100.0));
                sb.Add("Cos", Math.Cos(i / 100.0));
                return KeyValue.Create(i, sb.Series);
            });

            // Turn sequence of row information into data frame
            var df = Frame.FromRows(rows);
            var numNames = new SeriesBuilder<int, string>() {
                { 1, "one" }, { 2, "two" }, { 3, "three" }
            }.Series;
            numNames.Print();
            df.Print();

            var opts = Enumerable.Range(0, 10)
                .Select(x => KeyValue.Create(x, OptionalValue.OfNullable<int>(x)))
                .ToSparseSeries();
            opts.Print();
            Console.ReadKey();
        }
    }
}
